package com.ljh.controller;


import com.ljh.pojo.Department;
import com.ljh.service.IDepartmentService;
import com.ljh.utils.RespBean;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lijiahao
 * @since 2021-09-01
 */
@RestController
@RequestMapping("/system/basic/department")
public class DepartmentController {

    @Autowired
    private IDepartmentService departmentService;

    @ApiOperation(value = "查询部门")
    @GetMapping("/")
    public List<Department> findListDepartment(){
        return    departmentService.findListDepartment(-1);
    }

    @ApiOperation(value = "添加部门")
    @PostMapping("/")
    public RespBean addDepartment(@RequestBody Department department){

        return departmentService.addDepartment(department);

    }

    @ApiOperation(value = "删除部门")
    @DeleteMapping("/{id}")
    public RespBean deleteDepartment(Integer id){
        return departmentService.deleteDepartment(id);

    }

}
